import plotly.graph_objects as go
import numpy as np

def plotly_entry():
    # Define your 3D vector field (U, V, W components)
    # Example: a simple rotational field
    x, y, z = np.mgrid[-1:1:20j, -1:1:20j, -1:1:20j]
    U = -y
    V = x
    W = np.zeros_like(x)

    fig = go.Figure(data=go.Streamtube(x=x.flatten(), y=y.flatten(), z=z.flatten(),
                                       u=U.flatten(), v=V.flatten(), w=W.flatten(),
                                       sizeref=0.5,  # Adjust tube size
                                       maxdisplayed=300)) # Limit number of tubes for performance

    fig.update_layout(title="3D Streamtubes (Plotly)",
                      scene=dict(xaxis_title='X', yaxis_title='Y', zaxis_title='Z'))

    fig.show()